package com.bjc.principle.flyweight;

/**
 * @program: DesignPattern
 * @description: 享元模式
 * @author: bjc
 * @create: 2021-01-04 16:50
 */
public class FlyWeightPattern {
    public static void main(String[] args) {
//        BikeFlyWeight bike1 = BikeFlyWeightFactory.getInstance().getBike();
//        bike1.ride("ZhangSan");
//        bike1.back();

        BikeFlyWeight bike2 = BikeFlyWeightFactory.getInstance().getBike();
        bike2.ride("ZhaoSi");
        //bike2.back();

        BikeFlyWeight bike3 = BikeFlyWeightFactory.getInstance().getBike();
        bike3.ride("WangWu");
        bike3.back();

//        System.out.println(bike1==bike2);
        System.out.println(bike2==bike3);
    }
}
